package com.fluidops.datacatalog.reltables.sim;

import java.util.Collection;

import com.fluidops.datacatalog.reltables.model.Entity;
import com.fluidops.datacatalog.reltables.sim.entity.IEntitySimilarity;

public class AveragePair extends EntitySetSimilarity{

	public AveragePair(IEntitySimilarity entitySim){
		super(entitySim);
	}

	@Override
	public double calcEntitySetSimilarity(Collection<Entity> es1, Collection<Entity> es2) {
		double similarity = es1.size() * es2.size();
		
		if(similarity != 0){
			similarity = 1d / similarity;
			similarity *= applyEntitySimilarityMeasure(es1, es2);
		}
		
		return similarity;
	}


	
	
	
}
